import http from "../request.js";

// 耗材订单

// 所有耗材订单查询

export function selectAllOrder(data) {
  return http.request({
    url: "/admin/bagOrder/selectAllOrder",
    method: "post",
    data,
  });
}

// 查询耗材订单详情
export function selectBagOrderByNumber(number, status) {
  return http.request({
    url:
      "admin/bagOrder/selectBagOrderByNumber?number=" +
      number +
      "&status=" +
      status,
    method: "get",
  });
}

/* 
查询所有耗材,耗材明细
*/
export function selectAllDetail() {
  return http.request({
    url: "/admin/consumable/selectAllConsumable",
    method: "get",
  });
}
/* 
添加和修改耗材
*/
export function updateAndAddConsumable(data) {
  return http.request({
    url: "/admin/consumable/updateAndAddConsumable",
    method: "post",
    data,
  });
}

/* 
删除耗材
*/
export function deleteConsumable(data) {
  return http.request({
    url: "/admin/consumable/deleteConsumable",
    method: "post",
    data,
  });
}

/* 
分页查询所有耗材包
*/
export function selectAllConsumableBag(data) {
  return http.request({
    url: "/admin/consumable/selectAllConsumableBag",
    method: "post",
    data,
  });
}

/* 
修改和添加耗材包
*/
export function updateAndAddConsumableBag(data) {
  return http.request({
    url: "/admin/consumable/updateAndAddConsumableBag",
    method: "post",
    data,
  });
}

/* 
deleteConsumableBag
*/
export function deleteConsumableBag(data) {
  return http.request({
    url: "/admin/consumable/deleteConsumableBag",
    method: "post",
    data,
  });
}

/* 
上下架耗材包
*/
export function upOrDownConsumableBag(data) {
  return http.request({
    url: "/admin/consumable/upOrDownConsumableBag?id=" + data,
    method: "get",
  });
}

/* 
所有耗材退款订单查询
*/
export function selectAllConsumeRefundOrder(data) {
  return http.request({
    url: "/admin/cancelBagOrder/selectAllRefundOrder",
    method: "post",
    data,
  });
}
// 填写原因处理退款
export function manageRefund(data) {
  return http.request({
    url:
      "/admin/cancelBagOrder/manageRefund?content=" +
      data.content +
      "&number=" +
      data.number +
      "&status=" +
      data.status,
    method: "get",
  });
}
// 不填写原因
export function confirmRefund(data) {
  return http.request({
    url:
      "/admin/cancelBagOrder/manageRefund?number=" +
      data.number +
      "&status=" +
      data.status,
    method: "get",
  });
}
/* 
查看退款耗材订单详情
*/
export function selectOneRefundOrder(data) {
  return http.request({
    url: "/admin/cancelBagOrder/selectOneRefundOrder?number=" + data,
    method: "get",
  });
}

// 耗材订单直接退款

export function adminCancelOrder(data) {
  return http.request({
    url: "/admin/cancelBagOrder/adminCancelOrder?number=" + data,
    method: "get",
  });
}

/* 
查看退款设置
*/
export function selectConsumeOrderSet(data) {
  return http.request({
    url: "/admin/consumable/selectRefundOrderSet",
    method: "get",
    data,
  });
}

export function selectConsumableBagByDto(data) {
  return http.request({
    url: "admin/consumable/selectConsumableBagByDto",
    method: "post",
    data,
  });
}
// 审核状态
export function updateConsumableStatus(data) {
  return http.request({
    url: "admin/consumable/updateConsumableStatus",
    method: "get",
    params: data,
  });
}

/* 
修改退款设置
*/
export function updateConsumeOrderSet(data) {
  return http.request({
    url: "/admin/consumable/updateRefundOrderSet",
    method: "post",
    params: data,
  });
}

/*
处理退款
*/
// export function manageRefund(data) {
//     return http.request({
//         url: '/admin/consumable/manageRefund',
//         method: 'get',
//         data
//     })
// }
